package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.PatientQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.PatientDao;
import com.bbdjt.weixin.model.Patient;
import com.bbdjt.weixin.service.PatientService;

@Service("patientService")
public class PatientServiceImpl extends BaseServiceImpl<Patient> implements PatientService {
	
	@Override
    public List<Patient> selectByPatient(Patient patient, int page, int rows) {
        Example example = new Example(Patient.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(patient);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Patient> selectByPatient(Patient patient) {
        Example example = new Example(Patient.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(patient);
        return selectByExample(example);
    }

    @Override
    public PageInfo<PatientQueryModel> selectByPatientQueryModel(PatientQueryModel patient) {
    	return ((PatientDao) getMapper()).selectByPatientModel(patient);
    }

	@Override
	public List<Patient> selectByPatient(PatientQueryModel patient) {
		  Example example = new Example(Patient.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(patient);
	        PageHelper.startPage(patient.getPageNum(), patient.getPageSize(),patient.getOrderBy());
	        return selectByExample(example);
	}

	@Override
	public Patient selectPatient(Patient patient) {
		return ((PatientDao) getMapper()).selectPatient(patient);
	}

	
}